//
//  MBProgressHUD+JJQuick.m
//  YYFMMall
//
//  Created by chenzm on 2019/8/26.
//  Copyright © 2019 YuYou1. All rights reserved.
//

#import "MBProgressHUD+JJQuick.h"

@implementation MBProgressHUD (JJQuick)

+(void)jj_showTitle:(NSString*)title
               view:(UIView*)view{
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view?view:[UIApplication sharedApplication].keyWindow animated:YES];
    if (title.length) {
        hud.detailsLabel.text =title;
    }
    hud.animationType=MBProgressHUDAnimationZoomOut;
    hud.bezelView.color = kRGBA(0, 0, 0, 0.8);
    hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
    
    hud.customView.backgroundColor=[UIColor blackColor];
    hud.contentColor=[UIColor whiteColor];//字的颜色
}

+(void)jj_dismiss:(UIView*)view{
    UIView *viewToRemove = nil;
    for (UIView *v in [view subviews])
    {
        if ([v isKindOfClass:[MBProgressHUD class]])
        {
            viewToRemove = v;
            [viewToRemove removeFromSuperview];
        }
    }
}


+(void)jj_showDelayTitle:(NSString*)title{
    [self jj_showDelayTitle:title view:[UIApplication sharedApplication].keyWindow];
}


+(void)jj_showDelayTitle:(NSString*)title
               view:(UIView*)view{
    [self jj_showDelay:kMBPShowTime title:title view:view];
}
    
+(void)jj_showDelay:(float)delay
              title:(NSString*)title
               view:(UIView*)view{
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view?view:[UIApplication sharedApplication].keyWindow animated:YES];
    hud.contentColor=[UIColor whiteColor];//字的颜色
    hud.animationType=MBProgressHUDAnimationZoomOut;
    hud.userInteractionEnabled=NO;
    hud.bezelView.color = kRGBA(0, 0, 0, 0.8);
    hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
    
    // Set the annular determinate mode to show task progress.
    hud.mode = MBProgressHUDModeText;
    hud.detailsLabel.text = title;
    hud.detailsLabel.font = kFont(15);
    hud.detailsLabel.numberOfLines=0;
    hud.offset = CGPointMake(0.f, 0);
    hud.margin=20;
    [hud hideAnimated:YES afterDelay:delay];
    
}

@end
